<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<script>
  let arr1=[1,2];
  let arr2=[5,6];
  // 合并两个数组的值到一个数组中
  let arr=[];
  arr1.forEach(i=>arr.push(i))
  arr2.forEach(i=>arr.push(i))

  console.log(arr.toString())

  let arr3 =[...arr1,...arr2];
  console.log(arr3.toString())

  // 复制对象
  let user={
    id:1,
    name:"zs",
    age: 20
  }

  let user2 = {...user};
  user2.name="lisi";
  console.log(user2,user)
</script>

</body>
</html>
